﻿using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
using Model;

using Utility;

namespace DAL
{
    public class ReasonService
    {
        public int CreateReason(Reason reason)
        {
            MySqlParameter parm = new MySqlParameter("?Ret", MySqlDbType.Int32);
            parm.Value = -1;
            parm.Direction = System.Data.ParameterDirection.Output;

            MySqlParameter[] parms = new MySqlParameter[] {
                parm,
                new MySqlParameter("?IdeaID",reason.IID),
                new MySqlParameter("?UserID",reason.UID),
                new MySqlParameter("?RContent",reason.Content),
                new MySqlParameter("?Ctime",reason.Time)
            };

            MySQLHelper.ExecuteNonQuery("sp_CreateReason", parms);

            return Convert.ToInt32(parm.Value);
        }
    }
}
